1564b3515708ed2cfaf1825d8e7a128fcb47f85b,src/main/java/com/fabahaba/jedipus/cluster/Jedipus.java,Jedipus,apply,#ReadMode#number#Function#number#,318

Before Change


        throw new MaxRedirectsExceededException(moveEx);
      }

      if (client == null) {
        connHandler.refreshSlotCache();
      } else {
        connHandler.refreshSlotCache(client);
      }

      previousRedirectEx = moveEx;
    } catch (final RedisRetryableUnhandledException retryableEx) {
      if (!retryUnhandledRetryableExceptions) {
        throw retryableEx;
      }

      RedisClientPool.returnClient(pool, client);
      pool = null;
      final Node failedNode = client == null ? retryableEx.getNode() : client.getNode();
      client = null;
      retries = connHandler.getClusterNodeRetryDelay().markFailure(failedNode, maxRetries,
          retryableEx, retries);
    } finally {
      RedisClientPool.returnClient(pool, client);
      pool = null;
      client = null;
    }

    for (;;) {
      try {
        if (previousRedirectEx == null || !(previousRedirectEx instanceof AskNodeException)) {

          pool = connHandler.getSlotPool(readMode, slot);
          client = RedisClientPool.borrowClient(pool);

          final R result = clientConsumer.apply(client);
          connHandler.getClusterNodeRetryDelay().markSuccess(client.getNode());
          return result;
        }

        final Node askNode = previousRedirectEx.getTargetNode();
        pool = connHandler.getAskPool(askNode);
        client = RedisClientPool.borrowClient(pool);
        client.asking();
        final R result = clientConsumer.apply(client);
        connHandler.getClusterNodeRetryDelay().markSuccess(client.getNode());
        return result;
      } catch (final RedisConnectionException rce) {
        RedisClientPool.returnClient(pool, client);
        pool = null;
        final Node failedNode = client == null ? rce.getNode() : client.getNode();
        client = null;

        if (failedNode != null && refreshSlotCacheEvery > 0) {
          if (retries > 0 && retries % refreshSlotCacheEvery == 0) {
            connHandler.refreshSlotCache();
          }
        }

        retries = connHandler.getClusterNodeRetryDelay().markFailure(failedNode, maxRetries, rce,
            retries);
        continue;
      } catch (final AskNodeException askEx) {
        askEx.setPrevious(previousRedirectEx);

        try {
          RedisClientPool.returnClient(pool, client);
        } finally {
          client = null;
        }

        previousRedirectEx = askEx;
        continue;
      } catch (final SlotRedirectException moveEx) {
        moveEx.setPrevious(previousRedirectEx);

        if (++redirections > maxRedirections) {
          throw new MaxRedirectsExceededException(moveEx);
        }

        if (client == null) {
          connHandler.refreshSlotCache();
        } else {
          connHandler.refreshSlotCache(client);
        }

        previousRedirectEx = moveEx;

After Change


          throw new MaxRedirectsExceededException(moveEx);
        }

        connHandler.refreshSlotCache(moveEx);
        previousRedirectEx = moveEx;
        continue;
      } catch (final RedisRetryableUnhandledException retryableEx) {